// Fixed address mappings
#ifdef MIPS64
	// During an ECC exception addresses in this region
	// become an unmapped uncached window on phys memory
	#define REGION_START_ECC		0x0000000000000000ULL
	#define REGION_END_ECC			0x000000007FFFFFFFULL

	// KUSEG is cached, mapped, user accessable memory
	#define REGION_START_KUSEG		0x0000000000000000ULL
	#define REGION_END_KUSEG		0x3FFFFFFFFFFFFFFFULL

	// XSSEG is cached, mapped, supervisor accessable memory
	// available only in 64-bit mode
	#define REGION_START_XSSEG		0x4000000000000000ULL
	#define REGION_END_XSSEG		0x8FFFFFFFFFFFFFFFULL

	// CWIN is a cached window on physical memory available
	// only in 64-bit mode
	#define REGION_START_CWIN		0x9000000000000000ULL
	#define REGION_END_CWIN			0x97FFFFFFFFFFFFFFULL

	// UWIN in an uncached window on physical memory available
	// only in 64-bit mode
	#define REGION_START_UWIN		0x9800000000000000ULL
	#define REGION_END_UWIN			0xBFFFFFFFFFFFFFFFULL

	// XKSEG is cached, mapped, kernel accessable memory
	// available only in 64-bit mode
	#define REGION_START_XKSEG		0xC000000000000000ULL
	#define REGION_END_XKSEG		0xFFFFFFFF7FFFFFFFULL

	// KSEG0 is a cached window on physical memory
	#define REGION_START_KSEG0		0xFFFFFFFF80000000ULL
	#define REGION_END_KSEG0		0xFFFFFFFF9FFFFFFFULL

	// KSEG1 is an uncached window on physical memory
	#define REGION_START_KSEG1		0xFFFFFFFFA0000000ULL
	#define REGION_END_KSEG1		0xFFFFFFFFBFFFFFFFULL

	// SSEG0 is cached, mapped, supervisor accessable memory
	#define REGION_START_SSEG0		0xFFFFFFFFC0000000ULL
	#define REGION_END_SSEG0		0xFFFFFFFFDFFFFFFFULL

	// KSEG2 is cached, mapped, kernel accessable memory
	#define REGION_START_KSEG2		0xFFFFFFFFE0000000ULL
	#define REGION_END_KSEG2		0xFFFFFFFFFFFFFFFFULL
#else /* !MIPS64 */
	// These are defined the same above but for a 32 bit
	// machine
	#define REGION_START_ECC		0x00000000UL
	#define REGION_END_ECC			0x7FFFFFFFUL
	#define REGION_START_KUSEG		0x00000000UL
	#define REGION_END_KUSEG		0x7FFFFFFFUL
	#define REGION_START_KSEG0		0x80000000UL
	#define REGION_END_KSEG0		0x9FFFFFFFUL
	#define REGION_START_KSEG1		0xA0000000UL
	#define REGION_END_KSEG1		0xBFFFFFFFUL
	#define REGION_START_SSEG0		0xA0000000UL
	#define REGION_END_SSEG0		0xDFFFFFFFUL
	#define REGION_STAER_KSEG2		0xE0000000UL
	#define REGION_END_KSEG2		0xFFFFFFFFUL
#endif /* !MIPS64 */

#define PROT_CACHED					0x01
#define PROT_NOCOHERENT				0x02
#define PROT_MAPPED					0x04
#define PROT_USER					0x08
#define PROT_SUPERVISOR				0x10
#define PROT_KERNEL					0x20
#define PROT_READ					0x40
#define PROT_WRITE					0x80
#define PROT_RW						0xC0

#define MAP_DEFAULT					0
#define MAP_NONE					1
#define MAP_FIXED					2
#define MAP_TLB						3
#define MAP_ECC						4

#define F_TLB_NOCACHE				0x10
#define F_TLB_NOCOHERENT			0x18

mmu_error
translate_fixed(HOST *h, sim_addr vaddr, sim_addr *addr, mmu_prot *prot);

mmu_error
translate_tlb(HOST *h, sim_addr vaddr, sim_addr *addr, mmu_prot *prot);

mmu_error
translate_address(HOST *h, map_type map, sim_addr vaddr, sim_addr *addr, mmu_prot *prot);

mmu_error
locate_address(HOST *h, sim_addr addr, mmu_target *dest, mmu_prot *prot, mmu_dev **device);
